<?php
/*
Module:		Websearch
Version:	20071205a-DAT
File:		run.php
*/


  $SearchConfig = array();
  $SearchConfig['URLs#1']= array();
  $SearchConfig['URLs#2']= array();
  $SearchConfig['Commands']=array();
  
  $SearchConfig['URLs#1'][0]  ='http://search.yahooapis.com/WebSearchService/V1/webSearch?query=';
  $SearchConfig['URLs#2'][0]  ='&appid=kqp8LEfV34EojfEM6RWcGWSGsnFBIOvUwwk8aU9QHOoxYiyE5LJdwb3NFcNVzZyyDbA';
  $SearchConfig['Commands'][0]='!YAHOO';


for($i=0; $i < sizeof($SearchConfig['Commands']); $i++)	
  {
    if(strtoupper($args[0]) == $SearchConfig['Commands'][$i])
    {
      search($SearchConfig["URLs#1"][$i].urlencode(implode(' ',$args)).$SearchConfig["URLs#2"][$i]);
    }
  }
  
if(strtoupper($args[0]) == "!FIND")
{
$temp = "";
for($i=0; $i < sizeof($SearchConfig['Commands']); $i++)	
{
$temp = $temp.$SearchConfig['Commands'][$i]." ";
}

cmd_send(prep_text("Search",$temp));
cmd_send(prep_text("Search","Usage: <search-command> <term to look for>"));
}

//register commands 
if(strtoupper($args[0]) == "!COMMANDS")
{
	$COMMANDS=$COMMANDS.", [!FIND]";
}
?>

